<!-- numbox -->
<template>
  <div class="mui-numbox" data-numbox-min="1" data-numbox-max="9" style="height: 25px">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input id="test" class="mui-input-numbox" type="number"  :value="initval"
     @click="countChanged" ref="gcount" >
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>

<script>
import mui from '../../../public/lib/mui/js/mui.js'
export default {
  data() {
    return {};
  },
  props: ['initval', 'gid'],
  created() {},
  methods: {
    // 数量改变更新store中商品信息
    countChanged() {
      //this.$emit('getCount', parseInt(this.$refs.gcount.value))
      let count1 = parseInt(this.$refs.gcount.value)
      this.$store.commit('updateCart', {id: this.gid, count: count1});
      console.log(countChanged);
                  
    }
  },

  components: {}
};
</script>

<style lang='scss' scoped>
</style>